package com.cy.law.db.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

@Entity
public class Human implements Serializable {
    private Integer humanId;
    private String humanName;
    private String humanCode;
    private String password;
    private String phoneNumber;
    private String address;
    private Integer unitId;
    private String unitName;
    private Integer regionId;
    private String email;
    private Integer isLawPerson;
    private Byte dutyId;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "human_id")
    public Integer getHumanId() {
        return humanId;
    }

    public void setHumanId(Integer humanId) {
        this.humanId = humanId;
    }

    @Transient
    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    @Basic
    @Column(name = "human_name")
    public String getHumanName() {
        return humanName;
    }

    public void setHumanName(String humanName) {
        this.humanName = humanName;
    }

    @Basic
    @Column(name = "human_code")
    public String getHumanCode() {
        return humanCode;
    }

    public void setHumanCode(String humanCode) {
        this.humanCode = humanCode;
    }

    @Basic
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "phone_number")
    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    @Basic
    @Column(name = "address")
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Basic
    @Column(name = "unit_id")
    public Integer getUnitId() {
        return unitId;
    }

    public void setUnitId(Integer unitId) {
        this.unitId = unitId;
    }

    @Basic
    @Column(name = "region_id")
    public Integer getRegionId() {
        return regionId;
    }

    public void setRegionId(Integer regionId) {
        this.regionId = regionId;
    }

    @Basic
    @Column(name = "email")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "is_law_person")
    public Integer getIsLawPerson() {
        return isLawPerson;
    }

    public void setIsLawPerson(Integer isLawPerson) {
        this.isLawPerson = isLawPerson;
    }

    @Basic
    @Column(name = "duty_id")
    public Byte getDutyId() {
        return dutyId;
    }

    public void setDutyId(Byte dutyId) {
        this.dutyId = dutyId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Human human = (Human) o;
        return humanId == human.humanId &&
                Objects.equals(humanName, human.humanName) &&
                Objects.equals(humanCode, human.humanCode) &&
                Objects.equals(password, human.password) &&
                Objects.equals(phoneNumber, human.phoneNumber) &&
                Objects.equals(address, human.address) &&
                Objects.equals(unitId, human.unitId) &&
                Objects.equals(regionId, human.regionId) &&
                Objects.equals(email, human.email) &&
                Objects.equals(isLawPerson, human.isLawPerson) &&
                Objects.equals(dutyId, human.dutyId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(humanId, humanName, humanCode, password, phoneNumber, address, unitId, regionId, email, isLawPerson, dutyId);
    }
}
